//
//  HealthPayController.m
//  village_ios
//
//  Created by mac on 2019/8/9.
//  Copyright © 2019 com.sw.village. All rights reserved.
//

#import "HealthPayController.h"
#import "HealthPaySubmitRequest.h"
#import "HealthSubmitController.h"

typedef NS_ENUM(NSInteger,ChangeNumberType) {
    ChangeNumberTypeShopSub = 11,
    ChangeNumberTypeShopAdd = 12,
    ChangeNumberTypeRentalSub = 21,
    ChangeNumberTypeRentalAdd = 22,
    ChangeNumberTypeOtherSub = 31,
    ChangeNumberTypeOtherAdd = 32

};

@interface HealthPayController ()

//view
@property (weak, nonatomic) IBOutlet UIImageView *avatorImageView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *villageJobLabel;
@property (weak, nonatomic) IBOutlet UIImageView *partyIconView;
@property (weak, nonatomic) IBOutlet UILabel *phoneLabel;
@property (weak, nonatomic) IBOutlet UIButton *payButton;

//房租配置
@property (weak, nonatomic) IBOutlet UILabel *shopNumberLabel;
@property (weak, nonatomic) IBOutlet UILabel *rentalNumberLabel;
@property (weak, nonatomic) IBOutlet UILabel *otherNumberLabel;

@property (weak, nonatomic) IBOutlet UILabel *shopMonthFeeLabel;
@property (weak, nonatomic) IBOutlet UILabel *rentalMonthFeeLabel;
@property (weak, nonatomic) IBOutlet UILabel *otherMonthFeeLabel;

@property (weak, nonatomic) IBOutlet UILabel *shopFeeLabel;
@property (weak, nonatomic) IBOutlet UILabel *rentalFeeLabel;
@property (weak, nonatomic) IBOutlet UILabel *otherFeeLabel;

@property (weak, nonatomic) IBOutlet UILabel *monthFeeLabel;
@property (weak, nonatomic) IBOutlet UILabel *totalFeeLabel;


@end

@implementation HealthPayController

- (void)viewDidLoad {
    [super viewDidLoad];

}
- (void)loadNetwordData {
    
    //加载 该用户 这个月的 卫生费
    //其实都差不多 固定20一套
    
}
- (IBAction)toChangeNumber:(UIButton *)sender {
    
    if (sender.tag == ChangeNumberTypeShopSub ||
        sender.tag == ChangeNumberTypeShopAdd) {
        NSInteger number =  [self.shopNumberLabel.text integerValue];
        number += sender.tag == ChangeNumberTypeShopSub ? -1 :1;
        if (number <= 0) {
            number = 0;
        }
        self.shopNumberLabel.text = [NSString stringWithFormat:@"%@",@(number)];
    }else if (sender.tag == ChangeNumberTypeRentalSub ||
        sender.tag == ChangeNumberTypeRentalAdd) {
        NSInteger number =  [self.rentalNumberLabel.text integerValue];
        number += sender.tag == ChangeNumberTypeRentalSub ? -1 :1;
        if (number <= 0) {
            number = 0;
        }
        self.rentalNumberLabel.text = [NSString stringWithFormat:@"%@",@(number)];
    }else if (sender.tag == ChangeNumberTypeOtherSub ||
        sender.tag == ChangeNumberTypeOtherAdd) {
        NSInteger number =  [self.otherNumberLabel.text integerValue];
        number += sender.tag == ChangeNumberTypeOtherSub ? -1 :1;
        if (number <= 0) {
            number = 0;
        }
        self.otherNumberLabel.text = [NSString stringWithFormat:@"%@",@(number)];
    }
    
}


- (IBAction)toPay:(id)sender {

    HealthPaySubmitRequest *healthPayRequest = [HealthPaySubmitRequest new];
    healthPayRequest.shopNumber = [self.shopNumberLabel.text integerValue];
    healthPayRequest.rentalNumber = [self.rentalNumberLabel.text integerValue];
    healthPayRequest.otherNumber = [self.otherNumberLabel.text integerValue];


    HealthSubmitController *vc = [HealthSubmitController instanceWithStoryBoard];
    vc.healthPayRequest = healthPayRequest;
    [self.navigationController pushViewController:vc animated:YES];
}

@end
